﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using OrgChart.Logic.Interface;
using App.Service;
using OrgChart.Entity;

namespace OrgChart
{
    public partial class SecurityManagementLeft : System.Web.UI.Page
    {
        IUserGroup _userGroup = ServiceContainer.GetService<IUserGroup>();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                TreeNode root = new TreeNode();
                root.Text = Resources.lang.UserGroup;
                TreeView1.Nodes.Add(root);
                List<UserGroupEntity> lists = _userGroup.GetUserGroupList();
                foreach (UserGroupEntity userGroup in lists)
                {
                    TreeNode tn = new TreeNode(userGroup.UserGroupName);
                    tn.NavigateUrl = "SecurityManagementRight.aspx?UserGroup=" + userGroup.UserGroupName;
                    tn.Target = "frmSecurity";
                    root.ChildNodes.Add(tn);
                }

                TreeView1.ExpandAll();
            }
        }
    }
}